const path = require('path')
function resolve(dir) {
  return path.join(__dirname, dir)
}

module.exports = {
  outputDir: 'dist',
  publicPath: './',
  chainWebpack: config => {
    config.module.rule('svg').exclude.add(resolve('src/icons')).end();
    console.info(resolve('src/icons/svg'));
    config.module
      .rule('svg-sprite-loader')
      .test(/\.svg$/)
      .include.add(resolve('src/icons')).end()
      .use('svg-sprite-loader')
      .loader('svg-sprite-loader')
      .options({
        symbolId: 'icon-[name]'
      })
  },
  configureWebpack: {
    devtool: 'source-map',
  },
  devServer: {
    proxy: {
      // '/captcha': {
      //   // target: 'http://192.168.0.119:8085',
      //   target: 'http://192.168.0.163:8082/ssoServer/',
      //   changeOrigin: true,
      //   secure: false,
      //   pathRewrite: {
      //     '^/captcha': '' // /api
      //   }
      // },
      '/a': {
        // target: 'http://192.168.0.119:8085',
        // target: 'http://192.168.0.163:8082/fastflow-admin/',
        target:'http://192.168.0.163:8082/fastflow-admin',
        changeOrigin: true,
        secure: false,
        pathRewrite: {
          '^/a': '' 
        }
      },
    }
  },
  //rem单位转换
  css: { loaderOptions: { postcss: { plugins: [require('postcss-px2rem')({ remUnit: 20 })] } } }
}

